﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="POI.eTransmittal.WebApp._Default" %>

<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxMenu" tagprefix="dx" %>

<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxUploadControl" tagprefix="dx" %>

<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
</head>
<body>
    <form id="form1" runat="server">
    <script type="text/javascript">
       
        function OnTextChanged(uploadControl) {
            if (uploadControl.GetText() != '' || uploadControl.GetText() != null) {
                if (!isValidFileName(uploadControl.GetText())) {
                    uploadControl.ClearText();
                                  alert("File extension isn't allowed");
                }
            } else {
                return;
            }
        }
        function isValidFileName(fileName) {
            var fileParts = fileName.split(".");
            var fileExtension = fileParts[fileParts.length - 1];
            var allowExtensions = ['msg', 'pdf'];
            return arrayIndexOf(allowExtensions, fileExtension) != -1;
        }
        function arrayIndexOf(array, element) {
            for (var i = 0; i < array.length; i++) {
                if (array[i] == element)
                    return i;
            }
            return -1;
        }

        function OnCompleteUpload(s, e) {
            alert(e.callbackData);
            var iframe = document.getElementById('framePDFView');
            SetIFrameSource('framePDFView', e.callbackData);
        }

        function SetIFrameSource(cid, url)
    {
    var myframe = document.getElementById(cid);
if(myframe !== null)
{
    if(myframe.src){
        myframe.src = url; }
    else if(myframe.contentWindow !== null && myframe.contentWindow.location !== null){
        myframe.contentWindow.location = url; }
    else{ myframe.setAttribute('src', url); }
}
    </script>
    <div>
    
     <%--   <dx:ASPxMenu ID="ASPxMenu1" runat="server" AutoSeparators="RootOnly" 
            CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css" CssPostfix="PlasticBlue" 
            SpriteCssFilePath="~/App_Themes/PlasticBlue/{0}/sprite.css">
            <LoadingPanelImage Url="~/App_Themes/PlasticBlue/Web/Loading.gif">
            </LoadingPanelImage>
            <ItemSubMenuOffset FirstItemY="-1" LastItemY="-1" Y="-1" />
            <RootItemSubMenuOffset FirstItemX="1" LastItemX="1" X="1" />
            <ItemStyle DropDownButtonSpacing="13px" ToolbarDropDownButtonSpacing="5px" 
                ToolbarPopOutImageSpacing="5px" />
            <SubMenuStyle GutterWidth="0px" />
        </dx:ASPxMenu>--%>
    <p>Dear All,</p><p>We have received the incoming or outgoing transmittal that may related to you.<br /><i>Please click <a href="file:////adam-pc/temp/Transmittal/Mar 2012/incoming/TI-1203-11.pdf">here</a> to view the details.</i></p>Thank you,<br />IM Data Management
        <dx:ASPxButton ID="ASPxButton1" runat="server" Text="ASPxButton" 
            AutoPostBack="False" ClientInstanceName="ASPxButton1">
            <ClientSideEvents Click="function(s, e) {
	  var iframe = document.getElementById('framePDFView');
      if(iframe !== null)
{
    if(iframe.src){
        iframe.src = 'PDFViewerForm.aspx?pdfFileName=file://adam-pc/temp/Transmittal/Mar%202012/incoming/TI-1203-27.pdf'; }
    else if(iframe.contentWindow !== null && iframe.contentWindow.location !== null){
        iframe.contentWindow.location = 'PDFViewerForm.aspx?pdfFileName=file://adam-pc/temp/Transmittal/Mar%202012/incoming/TI-1203-27.pdf'; }
    else{ iframe.setAttribute('src', 'PDFViewerForm.aspx?pdfFileName=file://adam-pc/temp/Transmittal/Mar%202012/incoming/TI-1203-27.pdf'); }
}
          
}" />
        </dx:ASPxButton>
    </div>
    <dx:ASPxUploadControl ID="ASPxUploadControl1" runat="server" Width="280px" 
        onfileuploadcomplete="ASPxUploadControl1_FileUploadComplete">
<ValidationSettings MultiSelectionErrorText="Attention! 

The following {0} files are invalid because they exceed the allowed file size ({1}) or their extensions are not allowed. These files have been removed from selection, so they will not be uploaded. 

{2}" allowedfileextensions=".pdf, .msg"></ValidationSettings>
      
        <ClientSideEvents TextChanged="function(s, e) {
	OnTextChanged(s);
}" />
      
    </dx:ASPxUploadControl>

     <iframe runat="server" id="framePDFView" height="500px" width="100%" src="PdfViewerForm.aspx">
            </iframe>
           <dx:ASPxUploadControl ID="ASPxUploadControl" runat="server" 
        Width="280px" onfileuploadcomplete="ASPxUploadControl2_FileUploadComplete" 
        ShowUploadButton="True" ClientInstanceName="ASPxUploadControl">
<ValidationSettings MultiSelectionErrorText="Attention! 

The following {0} files are invalid because they exceed the allowed file size ({1}) or their extensions are not allowed. These files have been removed from selection, so they will not be uploaded. 

{2}"></ValidationSettings>
               <ClientSideEvents FileUploadComplete="function(s, e) {
	OnCompleteUpload(s,e);
}" />
    </dx:ASPxUploadControl>
    </form>
</body>
</html>
